@namespace BulmaRazor.Components
@inherits BulmaComponentBase

@if (WithContainer)
{
    <div class="table-container">
        <table @attributes="Attributes" class="@classes">
            @ChildContent
        </table>
    </div>
}
else
{
    <table @attributes="Attributes" class="@classes">
        @ChildContent
    </table>
}

@code {
    
    string classes => CssBuilder.Default("table")
        .AddClassFromAttributes(Attributes)
        .AddClass("is-bordered", IsBordered)
        .AddClass("is-striped", IsStriped)
        .AddClass("is-narrow", IsNarrow)
        .AddClass("is-hoverable", IsHoverable)
        .AddClass("is-fullwidth", IsFullwidth)
        .Build();

    /// <summary>
    /// 边框
    /// </summary>
    [Parameter]
    public bool IsBordered { get; set; }

    /// <summary>
    /// 条纹
    /// </summary>
    [Parameter]
    public bool IsStriped { get; set; }

    /// <summary>
    /// 狭窄
    /// </summary>
    [Parameter]
    public bool IsNarrow { get; set; }

    /// <summary>
    /// 可悬浮
    /// </summary>
    [Parameter]
    public bool IsHoverable { get; set; }

    /// <summary>
    /// 全宽
    /// </summary>
    [Parameter]
    public bool IsFullwidth { get; set; }

    /// <summary>
    /// 带容器
    /// </summary>
    [Parameter]
    public bool WithContainer { get; set; }


    /// <summary>
    /// 子内容
    /// </summary>
    [Parameter]
    public RenderFragment ChildContent { get; set; }

}